//
//  WPDetectionResultTopTableViewCell.m
//  health
//
//  Created by apple on 2021/11/10.
//  Copyright © 2021 zglee. All rights reserved.
//

#import "MJDetectionResultInfoTbvCell.h"

@interface MJDetectionResultInfoTbvCell ()
@property (weak, nonatomic) IBOutlet UILabel *gendeLabel;
@property (weak, nonatomic) IBOutlet UILabel *ageLabel;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *periodLabel;
@property (weak, nonatomic) IBOutlet UILabel *genderTitleLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *genderTitleLabelW;

@end

@implementation MJDetectionResultInfoTbvCell

- (void)awakeFromNib {
    [super awakeFromNib];
 
//    self.genderTitleLabel.adjustsFontSizeToFitWidth = true;
    CGSize genderTitleLabelSize = [self.genderTitleLabel sizeThatFits:CGSizeMake(MAXFLOAT, 25)];
    CGFloat width = genderTitleLabelSize.width + 20;
    if(width >= 70){
        self.genderTitleLabelW.constant = genderTitleLabelSize.width + 20;
    }

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

- (void)setRecordDataBaseModel:(RecordDataBaseModel *)recordDataBaseModel {
    
    self.nameLabel.text = recordDataBaseModel.patientName;
    self.ageLabel.text = @(recordDataBaseModel.age).description;
    self.gendeLabel.mj_localizable = recordDataBaseModel.gender;
    self.periodLabel.mj_localizable = recordDataBaseModel.period;
    self.timeLabel.text = [HealthHelper timeZoneWithDateTime:recordDataBaseModel.detectionDateTime dateFormat:MJUIDateFormat4];
    
}

@end
